package com.haowang.camera.manager;

import com.haowang.camera.activity.CameraActivity;

import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;

public class GestureManager extends CameraManagerBase implements
		OnGestureListener {

	private static final String TAG = GestureManager.class.getSimpleName();
	private GestureDetector mGestureDetector;

	public GestureManager(CameraActivity activity) {
		super(activity);
		mGestureDetector = new GestureDetector(activity, this);
	}

	public GestureDetector getGestureDetector() {
		return mGestureDetector;
	}

	@Override
	public boolean onDown(MotionEvent e) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
			float velocityY) {
		if (e1.getX() - e2.getX() > 120) {
			onLeftFling();
			return true;
		} else if (e1.getX() - e2.getX() < -120) {
			onRightFling();
			return true;
		}
		Log.i(TAG, "onFling unknow");
		return false;
	}

	private void onLeftFling() {
		Log.i(TAG, "onLeftFling");

	}

	private void onRightFling() {
		Log.i(TAG, "onLeftFling");

	}

	@Override
	public void onLongPress(MotionEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
			float distanceY) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void onShowPress(MotionEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public boolean onSingleTapUp(MotionEvent e) {
		// TODO Auto-generated method stub
		return false;
	}

}
